﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace LibrarySystem
{
    public partial class PrintSo_Exchange : Form
    {
        string NoSo_Exchange;
        AppManager LIB = new AppManager();
        public PrintSo_Exchange(string SO_Exchange_Number)
        {
            InitializeComponent();
            NoSo_Exchange = SO_Exchange_Number;
        }

        private void PrintSo_Exchange_Load(object sender, EventArgs e)
        {
            label17.Text = NoSo_Exchange;
            LIB.ComboDisplay(comboBox8, "select * from So_Exchange where رقم_إذن_الصرف = " + label17.Text + "", "So_Exchange", "رقم_إذن_الصرف");
            if (comboBox8.Text.Length > 0)
            {
                LIB.ComboDisplayChoose3(comboBox1, "select * from So_Exchange where رقم_إذن_الصرف = " + label17.Text + "", "So_Exchange", "التاريخ", label15);
            
                LIB.ComboDisplayChoose3(comboBox2, "select * from So_Exchange where رقم_إذن_الصرف = " + label17.Text + "", "So_Exchange", "كود_الكتاب", label12);

                LIB.ComboDisplayChoose3(comboBox3, "select * from So_Exchange where رقم_إذن_الصرف = " + label17.Text + "", "So_Exchange", "إسم_الجهة_المنصرف_إليها", label19);

                LIB.ComboDisplayChoose3(comboBox4, "select * from So_Exchange where رقم_إذن_الصرف = " + label17.Text + "", "So_Exchange", "عدد_الكراتين", label14);

                LIB.ComboDisplayChoose3(comboBox5, "select * from So_Exchange where رقم_إذن_الصرف = " + label17.Text + "", "So_Exchange", "تعبئة_الكرتونة", label20);
           
                LIB.ComboDisplayChoose3(comboBox6, "select * from So_Exchange where رقم_إذن_الصرف = " + label17.Text + "", "So_Exchange", "تعبئة_الكرتونة", label21);

                LIB.ComboDisplayChoose3(comboBox7, "select * from BOOKS where كود_الكتاب = '" + label12.Text + "'", "BOOKS", "إسم_الكتاب", label18);
                
           
            }
            else
            {
                MessageBox.Show("رقم الإذن غير موجود");
                this.Close();
            }

        }

        private void comboBox3_SelectedIndexChanged(object sender, EventArgs e)
        {

        }

        private void comboBox4_SelectedIndexChanged(object sender, EventArgs e)
        {

        }

        private void label7_Click(object sender, EventArgs e)
        {
            printForm1.Print();
        }
    }
}
